home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000037_icon-group-sender _Tue May 26 12:41:06 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id MAA27062
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Tue, 26 May 1998 12:41:06 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA01479; Tue, 26 May 1998 12:41:00 -0700
Date: Mon, 25 May 1998 08:18:17 -0700
From: Ralph Griswold <ralph>
Message-Id: <9805251518.AA02290@jupiter.CS.Arizona.EDU>
To: icon-group
Subject: forwarded message
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 2300
From: "Paul A. Sue" <Paul_A._Sue@notes.bctel.com>
To: icon-project@optima.CS.Arizona.EDU
Message-Id: <0825660C.006C0CCA.00@notes.bctel.com>
Date: Fri, 22 May 1998 11:48:10 -0800
Subject: Help Me Promote Icon!
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Status: RO
Hi,
[Sorry to bother you, but no one seems to be responding to
me post to comp.lang.icon.]
I'm a very recent convert to Icon, and thought I'd use it here at work
to write a simple translator that I had originally written in C and Perl.
I wanted to show that Icon would be an ideal language for many
of the projects at my company.
Anyhow, here's the Perl script along with sample input and output
to give you an idea of what I'm trying to do.
Thanks in advance,
Paul
=================================================
Paul A. Sue, Consultant ISM-BC AD/M
Voice-mail: (604) 432-4316 Pager: (604) 473-2811
E-mail: paul@wsi.ca or paul_sue@notes.bctel.com
[From comp.lang.icon]
--------------------- Start of included file ----------------------------
From: Paul A. Sue <paul_sue@notes.bctel.com>
Subject: Newbie question
Date: Thursday, May 14, 1998 1:46 PM
Hi,
I'm wondering if anyone can help me "translate" the following Perl
script to the Icon equivalent.
[Perl gurus feel free to improve on my perl script if you wish!]
Thanks in advance,
Paul
#!/usr/local/bin/perl
while (<>) {
chomp;
if (/[a-z]/) {
# --- convert from Directory to M/F format
s#$#//#;
s#^([a-z])#\*\1#;
s#(\s+)([a-z])# \*\2#g;
s#([a-z]+)([A-Z]+)#\1\(\2\)#g;
tr/a-z/A-Z/;
@result = split;
$index = $#result;
if ($index > 0) {
$result[$index - 1] .= ",";
}
}
else {
# --- convert from M/F to Directory format
s#//$##;
s#,##g;
tr/A-Z/a-z/;
s#(\()(.*)(\))#\U\2#g;
s#(^([a-z])|(\s+[a-z]))#\U\1\E#g;
s#\*##g;
@result = split;
}
print "@result\n";
next;
}
Sample input/output:
input of: "MacDonald John"
gives output of: "MAC(D)ONALD, JOHN//"
input of: "*VAN *DER(C)ORTLAND, NICK//"
gives output of: "van derCortland Nick"
--------------------- End of included file ----------------------------